package com.onlyphoto.onlymall.mvp.model

import com.onlyphoto.onlymall.api.Urls
import com.onlyphoto.onlymall.base.BaseModel
import com.onlyphoto.onlymall.base.BaseObserver
import com.onlyphoto.onlymall.bean.response.CategoryBean
import com.onlyphoto.onlymall.bean.response.SingleActivityBean
import com.onlyphoto.onlymall.utils.ConfigUtil
import com.onlyphoto.onlymall.utils.RxTransformer


class MCategoryImpl : BaseModel() {
    var url = ""
    fun requestCategory(grade: Int, up_id: String, baseObserver: BaseObserver<ArrayList<CategoryBean>>) {
        url = ConfigUtil.instance.getUrl(Urls.GOODS_CATEGORY)
        apiService().category(url, grade, up_id)
                .compose(RxTransformer.switchSchedulers(this))
                .subscribe(baseObserver)
    }

    fun requestSingleActivity(use_range: Int, range_cat1_id: Int, baseObserver: BaseObserver<SingleActivityBean>) {
        url = ConfigUtil.instance.getUrl(Urls.ACTIVITY_SINGLE)
        apiService().singleActivity(url, use_range, range_cat1_id)
                .compose(RxTransformer.switchSchedulers(this))
                .subscribe(baseObserver)
    }
}
